home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 28
/
Aminet 28 (1998)(GTI - Schatztruhe)[!][Dec 1998].iso
/
Aminet
/
game
/
board
/
Exchess.lha
/
EXChess
/
score.h
< prev
next >
Wrap
C/C++ Source or Header
|
1998-08-22
|
13KB
|
438 lines
/* Header for scoring alogrithm */
int BAD_BISHOP = 6;
int DOUBLED_PAWN = 8;
int WEAK_PAWN = 5;
int BACKWARD_PAWN = 7;
int PAWN_ISLAND = 8;
int PASSED_PAWN = 10;
int PAWN_SHIELD = 7;
int BISHOP_PAIR = 15;
int ROOK_CONN = 10;
int CON_PASSED_PAWNS = 400;
int FILE_BONUS = 10;
int HALF_FILE_BONUS = 5;
int HAS_CASTLED = 15;
int ROOK_KING_FILE = 2;
int TRADE_PIECES = 2;
int KEEP_PAWNS = 2;
// values for having pieces near the king, changes with stage
char king_proximity[4][7][8] = {
{ { 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0,35,25,10, 5, 0, 0, 0 },
{ 0, 5, 9, 9, 5, 0, 0, 0 },
{ 0, 7, 5, 3, 3, 0, 0, 0 },
{ 0, 7, 5, 3, 3, 0, 0, 0 },
{ 0,15,12, 7, 5, 3, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 } },
{ { 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0,35,25,10, 5, 0, 0, 0 },
{ 0, 5, 9, 9, 5, 0, 0, 0 },
{ 0, 7, 5, 3, 3, 0, 0, 0 },
{ 0, 7, 5, 3, 3, 0, 0, 0 },
{ 0,15,12, 7, 5, 3, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 } },
{ { 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0, 5, 9, 9, 5, 0, 0, 0 },
{ 0, 7, 5, 3, 3, 0, 0, 0 },
{ 0, 7, 5, 3, 3, 0, 0, 0 },
{ 0,15,12, 7, 5, 3, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 } },
{ { 0, 0, 0, 0, 0, 0, 0, 0 },
{ 0,-5,-3, 0, 2, 4, 7, 9 },
{ 0, 5, 9, 9, 5, 0, 0, 0 },
{ 0, 7, 5, 3, 3, 0, 0, 0 },
{ 0, 7, 5, 3, 3, 0, 0, 0 },
{ 0,15,12, 7, 5, 3, 0, 0 },
{ 0, 0, 0, 0, 0, 0, 0, 0 } } };
// Value of the pieces
int value[7] = { 0, 100, 330, 330, 550, 1000, 10000 };
// Lazy eval cutoff during search
int lazy[4] = { 150, 300, 600, 1000 };
// external search parameters
/* extensions */
extern int THRESHOLD, CAPT_EXT, CHECK_EXT, PAWN_EXT, RE_CAPT_EXT;
extern int INIT_EXT, MATE_EXT, PV_EXT, R, RAZOR_DEPTH;
// Piece square tables
short piece_sq[2][7][64];
// proto-types for piece square tables, first index is for the stage of
// the game, 2nd index is for piece
// stage 0 = opening
// stage 1 = early middle-game
// stage 2 = late middle-game
// stage 3 = ending
short proto_piece_sq[4][7][64] = {
// Reading these is a little tricky. These tables
// are set up to look like a chess board from white's
// point of view, but they are indexed from black's
// point of view. The whitef array is used to
// map these values to the right squares for white.
/*---------------------- Opening ------------------------*/
// For no piece ...
{ {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
// For the pawn
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 25, 25,-15,-15,-15,
0, 0, 0, 10, 10,-10,-10,-10,
0, 0, 0,-10,-10, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
// For knight proto_piece_sq[KNIGHT]
{
-8, -6, -4, -4, -4, -4, -6, -8,
-6, 0, 0, 0, 0, 0, 0, -6,
-4, 7, 8, 8, 8, 8, 7, -4,
-4, 7, 7, 8, 8, 7, 7, -4,
-4, 6, 7, 8, 8, 7, 6, -4,
-4, 5, 8, 6, 6, 8, 5, -4,
-6, 0, 0, 5, 5, 0, 0, -6,
-8,-10, -4, -4, -4, -4,-10, -8
},
// For bishop proto_piece_sq[BISHOP] =
{
0, 0, 0, 0, 0, 0, 0, 0,
-15, 0, 0, 0, 0, 0, 0,-15,
0, 0, 7, 8, 8, 7, 0, 0,
0, 7, 7, 8, 8, 7, 7, 0,
0, 7, 7, 8, 8, 7, 7, 0,
0, 0, 0, -5, -5, 0, 0, 0,
0, 5, 0, 0, 0, 0, 5, 0,
0, 0,-10, 0, 0,-10, 0, 0
},
// For rook proto_piece_sq[ROOK] =
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 5, 5, 0, 0, 0
},
// For queen proto_piece_sq[QUEEN] =
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 3, 3, 3, 0, 0, 0,
0, 0, 0, 3, 0, 0, 0, 0
},
// For king proto_piece_sq[KING] =
{
-25,-25,-25,-25,-25,-25,-25,-25,
-25,-25,-25,-25,-25,-25,-25,-25,
-25,-25,-25,-25,-25,-25,-25,-25,
-25,-25,-25,-25,-25,-25,-25,-25,
-25,-25,-25,-25,-25,-25,-25,-25,
-25,-25,-25,-25,-25,-25,-25,-25,
-5, -5,-25,-25,-25,-25, -5, -5,
10, 10, 10,-15, 0,-15, 10, 10
} },
/*---------------------- Early Middle Game ------------------------*/
// For no piece ...
{ {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
// For the pawn
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 25, 25, 0, 0, 0,
0, 0, 0, 25, 25,-15,-15,-15,
0, 0, 0, 10, 10,-15, -5, -5,
0, 0, 0,-10,-10, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
// For knight proto_piece_sq[KNIGHT] =
{
-10, -7, -5, -5, -5, -5, -5,-10,
-7, 2, 4, 4, 4, 4, 2, -7,
-5, 7, 8, 8, 8, 8, 7, -5,
-5, 7, 7, 8, 8, 7, 7, -5,
-5, 6, 7, 8, 8, 7, 6, -5,
-5, 3, 8, 6, 6, 8, 3, -5,
-7, 0, 3, 5, 5, 3, 0, -7,
-10,-10, -5, -5, -5, -5,-10,-10
},
// For bishop proto_piece_sq[BISHOP] =
{
0, 0, 0, 0, 0, 0, 0, 0,
-15, 0, 0, 0, 0, 0, 0,-15,
0, 0, 7, 8, 8, 7, 0, 0,
0, 7, 7, 8, 8, 7, 7, 0,
0, 7, 7, 8, 8, 7, 7, 0,
0, 0, 0, -5, -5, 0, 0, 0,
0, 5, 0, 0, 0, 0, 5, 0,
0, 0,-10, 0, 0,-10, 0, 0
},
// For rook proto_piece_sq[ROOK] =
{
0, 0, 0, 0, 0, 0, 0, 0,
10, 10, 10, 10, 10, 10, 10, 10,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 5, 5, 0, 0, 0
},
// For queen proto_piece_sq[QUEEN] =
{
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 3, 3, 3, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
// For king proto_piece_sq[KING] =
{
-25,-25,-25,-25,-25,-25,-25,-25,
-25,-25,-25,-25,-25,-25,-25,-25,
-25,-25,-25,-25,-25,-25,-25,-25,
-25,-25,-25,-25,-25,-25,-25,-25,
-25,-25,-25,-25,-25,-25,-25,-25,
-25,-25,-25,-25,-25,-25,-25,-25,
-5, -5,-25,-25,-25,-25, -5, -5,
10, 10, 10,-15, 0,-15, 10, 10
} },
/*---------------------- Late Middle Game ------------------------*/
// For no piece ...
{ {
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0
},
// For the pawn
{
0, 0, 0, 0, 0, 0, 0, 0,
100,100,100,100,100,100,100,100,
20, 20, 20, 25, 25, 20, 20, 25,
10, 10, 10, 15, 15, 10, 10,